home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / 1.2 / scripts / glowing-logo.scm.z / glowing-logo.scm
Text File  |  2002-07-08  |  3KB  |  103 lines

  1. ;  GLOWING
  2. ;  Create a text effect that simulates a glowing hot logo
  3.  
  4. (define (apply-glowing-logo-effect img
  5.                    logo-layer
  6.                    size
  7.                    bg-color)
  8.   (let* ((grow (/ size 4))
  9.      (feather1 (/ size 3))
  10.      (feather2 (/ size 7))
  11.      (feather3 (/ size 10))
  12.      (width (car (gimp-drawable-width logo-layer)))
  13.      (height (car (gimp-drawable-height logo-layer)))
  14.      (glow-layer (car (gimp-layer-copy logo-layer TRUE)))
  15.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  16.      (old-fg (car (gimp-palette-get-foreground)))
  17.      (old-bg (car (gimp-palette-get-background))))
  18.     (gimp-image-resize img width height 0 0)
  19.     (gimp-image-add-layer img bg-layer 1)
  20.     (gimp-image-add-layer img glow-layer 1)
  21.  
  22.     (gimp-selection-none img)
  23.     (gimp-palette-set-background bg-color)
  24.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  25.  
  26.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  27.     (gimp-palette-set-background '(0 0 0))
  28.     (gimp-edit-fill logo-layer BG-IMAGE-FILL)
  29.  
  30.     (gimp-selection-layer-alpha logo-layer)
  31.     (gimp-selection-feather img feather1)
  32.     (gimp-palette-set-background '(221 0 0))
  33.     (gimp-edit-fill glow-layer BG-IMAGE-FILL)
  34.     (gimp-edit-fill glow-layer BG-IMAGE-FILL)
  35.     (gimp-edit-fill glow-layer BG-IMAGE-FILL)
  36.  
  37.     (gimp-selection-layer-alpha logo-layer)
  38.     (gimp-selection-feather img feather2)
  39.     (gimp-palette-set-background '(232 217 18))
  40.     (gimp-edit-fill glow-layer BG-IMAGE-FILL)
  41.     (gimp-edit-fill glow-layer BG-IMAGE-FILL)
  42.  
  43.     (gimp-selection-layer-alpha logo-layer)
  44.     (gimp-selection-feather img feather3)
  45.     (gimp-palette-set-background '(255 255 255))
  46.     (gimp-edit-fill glow-layer BG-IMAGE-FILL)
  47.     (gimp-selection-none img)
  48.  
  49.     (gimp-layer-set-mode logo-layer OVERLAY)
  50.     (gimp-layer-set-name glow-layer "Glow Layer")
  51.  
  52.     (gimp-palette-set-background old-bg)
  53.     (gimp-palette-set-foreground old-fg)))
  54.  
  55.  
  56. (define (script-fu-glowing-logo-alpha img
  57.                       logo-layer
  58.                       size
  59.                       bg-color)
  60.   (begin
  61.     (gimp-undo-push-group-start img)
  62.     (apply-glowing-logo-effect img logo-layer size bg-color)
  63.     (gimp-undo-push-group-end img)
  64.     (gimp-displays-flush)))
  65.  
  66. (script-fu-register "script-fu-glowing-logo-alpha"
  67.             _"<Image>/Script-Fu/Alpha to Logo/Glowing Hot..."
  68.             "Glowing hot logos"
  69.             "Spencer Kimball"
  70.             "Spencer Kimball"
  71.             "1997"
  72.             "RGBA"
  73.                     SF-IMAGE      "Image" 0
  74.                     SF-DRAWABLE   "Drawable" 0
  75.             SF-ADJUSTMENT _"Effect Size (pixels * 3)" '(150 2 1000 1 10 0 1)
  76.             SF-COLOR      _"Background Color" '(7 0 20)
  77.             )
  78.  
  79. (define (script-fu-glowing-logo text
  80.                 size
  81.                 font
  82.                 bg-color)
  83.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  84.      (border (/ size 4))
  85.      (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  86.     (gimp-image-undo-disable img)
  87.     (apply-glowing-logo-effect img text-layer size bg-color)
  88.     (gimp-image-undo-enable img)
  89.     (gimp-display-new img)))
  90.  
  91. (script-fu-register "script-fu-glowing-logo"
  92.             _"<Toolbox>/Xtns/Script-Fu/Logos/Glowing Hot..."
  93.             "Glowing hot logos"
  94.             "Spencer Kimball"
  95.             "Spencer Kimball"
  96.             "1997"
  97.             ""
  98.             SF-STRING     _"Text" "GLOWING"
  99.             SF-ADJUSTMENT _"Font Size (pixels)" '(150 2 1000 1 10 0 1)
  100.             SF-FONT       _"Font" "-*-Slogan-*-r-*-*-24-*-*-*-p-*-*-*"
  101.             SF-COLOR      _"Background Color" '(7 0 20)
  102.             )
  103.